Function Reference

_ArrayPop

Returns the last element of an array, deleting that element from the array at the same time.

#include <Array.au3>
_ArrayPop ( $avArray )

 

Parameters

$avArray The array to be decreased.

 

Return Value

Success: Returns the value of the last element.
Failure: Returns an empty string.
@Error: 0 = No error.
1 = $avArray isn't an array.

 

Remarks

This function changes the array in place by useing the ByRef keyword in the parameter definition of $avArray. So, not only does it return the last element of the array, but it ALSO changes the array to have 1 less element.

 

Related

None.

 

Example


#include <Array.au3>

Dim $avArray[10]
$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

While UBound($avArray) > 0
   MsgBox(0,'',_ArrayPop($avArray))
   _ArrayDisplay( $avArray, "Entries left in the array" )
WEnd

Exit